<?php
	header("Content-Type: text/html;charset=utf-8");
	include("function/_nosql.php"); //
	include("function/function.php");
	$kboy_userid = $_SESSION['kboy_userid'];
	$kboy_user = $_SESSION['kboy_user'];
	
	$uid = chkstr(trim($_REQUEST['uid']));
	$ac = chkstr(trim($_REQUEST['ac']));
	if($uid==0){
		echo erro("游客身份！无法查看");
	}
	if(empty($uid)){
		echo erro("参数错误？");
	}
	if(!is_numeric($uid)){
		echo erro("参数错误！");
	}
	if(getNewsNums("kboy_user","uid=$uid") <1){
		echo erro("游客身份！无法查看");
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>最新动态_社区_<?= $web_titles ?></title>
<meta name="Keywords" content="最新动态,社区,<?= $web_keywords ?>" />
<meta name="Description" content="<?= $web_description ?>" />
<link rel="stylesheet" href="css/common.css"/>
<link rel="stylesheet" href="css/sq.css"/>
<script type="text/javascript" src="js/baidutongji.js"></script>
</head>
<body>
    <!--top-bar begin-->
	<? include("_include.top.topbar.php") ?>
    <!--top-bar end-->
    <!--header begin-->
	<? include("_include.top.navbar.php") ?>
    <!--banner begin-->
	<? include("_include.forum.banners.php") ?>
    <!--banner end-->
    <!--活动 begin-->
    <?php if($_SESSION['kboy_userid'] != $uid) {?>
    <div class="sq-wrap">
		<? include("_include.forum.title.php") ?>
        <div class="sq-bd">
			<? include("_include.forum.topnav.php") ?>
            <div class="sq-bd-con">
                <div class="sq-bd-l1">
                    <div class="fn-feed-control">
                        <div class="feed-control">
                             <a href="forum_news.php?uid=<?=$uid?>&ac=my" <? if($ac=="my"){ echo " class=\"on\"";}?>>ta的动态</a>
                            <a href="forum_news.php?uid=<?=$uid?>&ac=lv"<? if($ac=="lv"){ echo " class=\"on\"";}?>>驴友直播</a>
                            <a href="forum_news.php?uid=<?=$uid?>" <? if($ac==""){ echo " class=\"on\"";}?>>好友动态</a>
                            <a href="javascript:;" class="feed_me_refresh" id="refresh"><i class="icon-refresh"></i></a>
                        </div>
                    </div>
                    <div class="fn-feed-container">
                        <div class="feed-inner">
                            <ul class="feed_friend_list">
							<?php
								$SQL = "";
								$pagesize = 10; // 分页数量
								$pageval = chkstr(trim($_REQUEST['page'])); // 获取Page的值
								if($pageval){
									if(!is_numeric($pageval)){
										echo erro("Page Error");
									}
									if($pageval <= 1){
										$pageval = 1;
									}
									$page = ($pageval-1) * $pagesize;
									$page .= ",";
								}else{
									$pageval = 1;
								}
								
								$pagesql = "select * from kboy_forum_news where tid=$uid order by id desc";
								$pagenum = mysql_num_rows(mysql_query($pagesql)); // 总记录数
								$pagecount = ceil($pagenum/$pagesize); // 共分多少页
								if($pageval > $pagecount){
									$pageval = $pagecount;
								}
								
								$news_sql = $pagesql." limit $page $pagesize";
								$news_rows = mysql_query($news_sql);
								$i = 1;
								while($news_rs = mysql_fetch_assoc($news_rows)){
								
									$content = json_decode($news_rs['news_text']);
								//	var_dump($content);
							?>
                                <li class="f-single">
                                    <div class="f-aside">
                                        <div class="f-user-pto">
                                            <a href="forum_news.php?uid=<?=$news_rs['tid']?>" target="_blank">
											
												<?php
													$pic = getClassName('kboy_user','user_face','uid='.$news_rs['tid']);
													if($pic){
														$member_pic = $pic;
													}else{
														$member_pic = "images/f_pic1_6.jpg";
													}
												?>
                                            <img src="<?php echo $member_pic;?>" width="58" height="58" alt=""/>
                                               
                                            </a>
                                        </div>
                                        <div class="f-user-info">
                                            <div class="f-nick"><a href="forum_news.php?uid=<?=$news_rs['tid']?>"><?php echo getUserNickName($news_rs['tid']);?></a></div>
                                            <div class="info-detail">
                                                <span class="time"><?php echo $news_rs['news_addtime']?></span>
                                               <!-- <span class="state"><i class="icon-browse"></i>浏览(0)</span>-->
                                            </div>
                                        </div>
                                    </div>
                                    <div class="f-wrap">
                                        <div class="f-item">
                                            <div class="f-info"><?php echo $content->news_text;?></div>
                                            <div class="sq_summary">
												<?php
													if(count($content->images)){
												?>
													<div class="f-ct">
														<div class="img-box-wrap">
															<div class="img-box">
																<?php
																
																	foreach($content->images as $v){
																		echo "<a href='javascript:;' class='img-two'><img src='".$v."' /></a>";
																	}
																?>
																
															</div>
														</div>
													</div>
												<?php
													}
												?>
                                                <div class="f-op-wrap">
                                                    <div class="f-detail">
													<?php
														$soon = "";
														$getSoonIDList = "";
														getSoonIDList($news_rs['id'],'kboy_forum_news');
														$soon = ltrim($getSoonIDList,',');
													?>
                                                        <a class="f-detail-comment" href="javascript:void(0);"><i class="ui-icon icon-comment"></i>回复(<?php echo count(explode(',',$soon));?>)</a>
                                                        <a class="f-detail-praise" href="forum_news_zandel.php?action=dianzan&id=<?=$news_rs['id']?>" data-id="<?php echo $news_rs['id']?>" ><i class="ui-icon icon-praise"></i>赞(<span class="num"><?=$news_rs['news_good']?></span>)</a>
<!--                                                        <a class="f-detail-collect" href="server/test.php?action=shoucang"><i class="ui-icon icon-collect"></i>收藏</a>
-->                                                        <?php 
															if($kboy_userid == $uid){
																echo "<a class='f-detail-delete' href='forum_news_zandel.php?action=shanchu&id=".$news_rs['id']."'  ><i class='ui-icon icon-delete'></i>删除</a>";
															}
															
														?>
                                                    </div>
                                                    <!--<div class="f-like">
                                                        <div class="icon-btn">
                                                            <a href="javascript:;" class="praise"><i class="icon-praise"></i></a>
                                                        </div>
                                                        <div class="user-list">
                                                        </div>
                                                    </div>-->
													<?php
														if(getNewsNums('kboy_forum_news',"pid = ".$news_rs['id'])){
													?>
                                                    <div class="mod-comments">
													
                                                        <div class="comments-list ">
                                                            <ul>
																<?php
																	$com_sql = "select * from kboy_forum_news where pid = ".$news_rs['id'];
																	$com_re = mysql_query($com_sql);
																	while($com_arr = mysql_fetch_assoc($com_re)){
																	
																?>	
                                                                <li class="comments-item bor3">
                                                                    <div class="comments-item-bd">
                                                                        <div class="ui-avatar">
                                                                            <a href="#" target="_blank">
																			<?php
																				$pic = getClassName('kboy_user','user_face','uid='.$com_arr['uid']);
																				if($pic){
																					$member_pic = $pic;
																				}else{
																					$member_pic = "images/f_pic1_6.jpg";
																				}
																			?>
                                                                                <img class="q_namecard" src="<?php echo $member_pic;?>">
                                                                               
                                                                            </a>
                                                                        </div>
                                                                        <div class="comments-content">
                                                                            <a class="c_tx" target="_blank" href="#"><?php echo getUserNickName($com_arr['uid']);?></a>&nbsp; : <?php echo $com_arr['news_text'];?>
                                                                            <div class="comments-op">
                                                                                <span class=" ui-mr10 state"><?php echo $com_arr['news_addtime'];?></span>
                                                                                <a class="act-reply" href="javascript:;"><b class="hide-clip">回复</b></a>
																				<!--
                                                                                <a class="act-delete none" href="server/test.php?action=delchildmsg"><b class="hide-clip">删除</b></a>
																				-->
                                                                            </div>
                                                                        </div>
                                                                        <div class="comment-box-wrap">
                                                                            <form action="forum_newssave.php?action=reply&pid=<?php echo $com_arr['id'];?>" method="post">
																				<div class="sq-editor-cont">
																					<div class="sq-editor-text">
																						<div contenteditable="true" class="textarea"></div>
																						<input class="textarea-hidden" type="hidden"  name="strhtml" />
																					</div>
																					<div class="sq-editor-ft">
																						<div class="sq-editor-attach">
																							<ul>
																								<li><a class="btn-link-append" href="javascript:;">超链接<i class="icon icon-link"></i></a></li>
																							</ul>
																						</div>
																						<div class="sq-editor-op"><input type="submit" value="发表" class='btn-post' ></div>
																					</div>
																				</div>
																			</form>
                                                                        </div>
                                                                        <?php echo getComList($com_arr['id'],'kboy_forum_news','forum_newssave.php');?>
                                                                    </div>
                                                                </li>
																<?php	
																	}
																?>
																
                                                            </ul>
                                                         </div>
														 <?php	
															}
														?>
                                                        <div class="mod-commnets-poster">
                                                            <div class="comments-box" >
                                                                <div class="text-input"><a href="javascript:;" class="sq-tx">我也说一句</a></div>
                                                                <div class="mod-insert-mess"><a href="javascript:;"><i class="icon icon-mess"></i></a></div>
                                                            </div>
                                                            <div class="comment-box-wrap">
                                                                <form action="forum_newssave.php?action=reply&pid=<?php echo $news_rs['id'];?>" method="post">
                                                                    <div class="sq-editor-cont">
                                                                        <div class="sq-editor-text">
                                                                            <div contenteditable="true" class="textarea"></div>
                                                                            <input class="textarea-hidden" type="hidden" name="strhtml" />
                                                                        </div>
                                                                        <div class="sq-editor-ft">
                                                                            <div class="sq-editor-attach">
                                                                                <ul>
                                                                                    <li><a class="btn-link-append" href="javascript:;">超链接<i class="icon icon-link"></i></a></li>
                                                                                </ul>
                                                                            </div>
                                                                            <div class="sq-editor-op"><a href="javascript:void(0)" class="btn-post">发表</a></div>
                                                                        </div>
                                                                    </div>
                                                                </form>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                    </div>
                                </li>
							<?php
								}
							?>
								
                            </ul>
                            <!-- <div class="s-watch-more">
                                <a href="javascript:;">
                                    <span>查看更多</span>
                                    <i></i>
                                </a>
                            </div> -->
										<?php
												if($pagenum > $pagesize){
													echo "<div class=\"pagination\"><ul>";
													$url = "forum_news.php?uid=$uid";//当前页面
													pagebar($pagecount, $pageval, 7, $url);
													echo "</ul></div>";
												}
										?>
								
                                   

                        </div>
                    </div>
                </div>
				
				
				<? include("_include.forum.right.php") ?>
				
            </div>
        </div>
    </div>
<?php }else{ ?>
    <div class="sq-wrap">
		<? include("_include.forum.title.php") ?>
        <div class="sq-bd">
			<? include("_include.forum.topnav.php") ?>
            <div class="sq-bd-con">
                <div class="sq-bd-l1">
                    <div class="post-container">
					
					
						<form action="forum_newssave.php?action=add" method="post">
							<div class="sq-editor-cont">
								<div class="sq-editor-text">
									<div contenteditable="true" class="textarea">说点什么吧</div>
									<input class="textarea-hidden" type="hidden" name="strhtml" />
								</div>
								<div class="sq-editor-ft">
									<div class="sq-editor-attach">
										<ul>
											<li>
												<a href="javascript:;">
													图片
													<i class="icon icon-pic"></i>
													<input type="file" name='imgFile' class="btn-img-upload" />
												</a>
											</li>
											<li><a class="btn-link-append" href="javascript:;">超链接<i class="icon icon-link"></i></a></li>
										</ul>
									</div>
									<div class="sq-editor-op"><a href="javascript:void(0)" class="btn-post"><i class="icon icon-post"></i>发 表</a></div>
								</div>
								<div class="sq-editor-pics">
									<ul class="clearfix">
									</ul>
								</div>
							</div>
						</form>
					
					
                       
                    </div>
                    <div class="fn-feed-control">
                        <div class="feed-control">
                             <a href="forum_news.php?uid=<?=$uid?>&ac=my" <? if($ac=="my"){ echo " class=\"on\"";}?>>我的动态</a>
                            <a href="forum_news.php?uid=<?=$uid?>&ac=lv"<? if($ac=="lv"){ echo " class=\"on\"";}?>>驴友直播</a>
                            <a href="forum_news.php?uid=<?=$uid?>" <? if($ac==""){ echo " class=\"on\"";}?>>好友动态</a>
                            <a href="javascript:;" class="feed_me_refresh" id="refresh"><i class="icon-refresh"></i></a>
                        </div>
                    </div>
                    <div class="fn-feed-container">
                        <div class="feed-inner">
                            <ul class="feed_friend_list">
							<?php
								$SQL = "";
								$pagesize = 10; // 分页数量
								$pageval = chkstr(trim($_REQUEST['page'])); // 获取Page的值
								if($pageval){
									if(!is_numeric($pageval)){
										echo erro("Page Error");
									}
									if($pageval <= 1){
										$pageval = 1;
									}
									$page = ($pageval-1) * $pagesize;
									$page .= ",";
								}else{
									$pageval = 1;
								}
								
								$pagesql = "select * from kboy_forum_news where tid=$uid order by id desc";
								$pagenum = mysql_num_rows(mysql_query($pagesql)); // 总记录数
								$pagecount = ceil($pagenum/$pagesize); // 共分多少页
								if($pageval > $pagecount){
									$pageval = $pagecount;
								}
								
								$news_sql = $pagesql." limit $page $pagesize";
								$news_rows = mysql_query($news_sql);
								$i = 1;
								while($news_rs = mysql_fetch_assoc($news_rows)){
								
									$content = json_decode($news_rs['news_text']);
								//	var_dump($content);
							?>
                                <li class="f-single">
                                    <div class="f-aside">
                                        <div class="f-user-pto">
                                            <a href="forum_news.php?uid=<?=$news_rs['tid']?>" target="_blank">
											
												<?php
													$pic = getClassName('kboy_user','user_face','uid='.$news_rs['tid']);
													if($pic){
														$member_pic = $pic;
													}else{
														$member_pic = "images/f_pic1_6.jpg";
													}
												?>
                                            <img src="<?php echo $member_pic;?>" width="58" height="58" alt=""/>
                                               
                                            </a>
                                        </div>
                                        <div class="f-user-info">
                                            <div class="f-nick"><a href="forum_news.php?uid=<?=$news_rs['tid']?>"><?php echo getUserNickName($news_rs['tid']);?></a></div>
                                            <div class="info-detail">
                                                <span class="time"><?php echo $news_rs['news_addtime']?></span>
                                               <!-- <span class="state"><i class="icon-browse"></i>浏览(0)</span>-->
                                            </div>
                                        </div>
                                    </div>
                                    <div class="f-wrap">
                                        <div class="f-item">
                                            <div class="f-info"><?php echo $content->news_text;?></div>
                                            <div class="sq_summary">
												<?php
													if(count($content->images)){
												?>
													<div class="f-ct">
														<div class="img-box-wrap">
															<div class="img-box">
																<?php
																
																	foreach($content->images as $v){
																		echo "<a href='javascript:;' class='img-two'><img src='".$v."' /></a>";
																	}
																?>
																
															</div>
														</div>
													</div>
												<?php
													}
												?>
                                                <div class="f-op-wrap">
                                                    <div class="f-detail">
													<?php
														$soon = "";
														$getSoonIDList = "";
														getSoonIDList($news_rs['id'],'kboy_forum_news');
														$soon = ltrim($getSoonIDList,',');
													?>
                                                        <a class="f-detail-comment" href="javascript:void(0);"><i class="ui-icon icon-comment"></i>回复(<?php echo count(explode(',',$soon));?>)</a>
                                                        <a class="f-detail-praise" href="forum_news_zandel.php?action=dianzan&id=<?=$news_rs['id']?>" data-id="<?php echo $news_rs['id']?>" ><i class="ui-icon icon-praise"></i>赞(<span class="num"><?=$news_rs['news_good']?></span>)</a>
<!--                                                        <a class="f-detail-collect" href="server/test.php?action=shoucang"><i class="ui-icon icon-collect"></i>收藏</a>
-->                                                        <?php 
															if($kboy_userid == $uid){
																echo "<a class='f-detail-delete' href='forum_news_zandel.php?action=shanchu&id=".$news_rs['id']."'  ><i class='ui-icon icon-delete'></i>删除</a>";
															}
															
														?>
                                                    </div>
                                                    <!--<div class="f-like">
                                                        <div class="icon-btn">
                                                            <a href="javascript:;" class="praise"><i class="icon-praise"></i></a>
                                                        </div>
                                                        <div class="user-list">
                                                        </div>
                                                    </div>-->
													<?php
														if(getNewsNums('kboy_forum_news',"pid = ".$news_rs['id'])){
													?>
                                                    <div class="mod-comments">
													
                                                        <div class="comments-list ">
                                                            <ul>
																<?php
																	$com_sql = "select * from kboy_forum_news where pid = ".$news_rs['id'];
																	$com_re = mysql_query($com_sql);
																	while($com_arr = mysql_fetch_assoc($com_re)){
																	
																?>	
                                                                <li class="comments-item bor3">
                                                                    <div class="comments-item-bd">
                                                                        <div class="ui-avatar">
                                                                            <a href="#" target="_blank">
																			<?php
																				$pic = getClassName('kboy_user','user_face','uid='.$com_arr['uid']);
																				if($pic){
																					$member_pic = $pic;
																				}else{
																					$member_pic = "images/f_pic1_6.jpg";
																				}
																			?>
                                                                                <img class="q_namecard" src="<?php echo $member_pic;?>">
                                                                               
                                                                            </a>
                                                                        </div>
                                                                        <div class="comments-content">
                                                                            <a class="c_tx" target="_blank" href="#"><?php echo getUserNickName($com_arr['uid']);?></a>&nbsp; : <?php echo $com_arr['news_text'];?>
                                                                            <div class="comments-op">
                                                                                <span class=" ui-mr10 state"><?php echo $com_arr['news_addtime'];?></span>
                                                                                <a class="act-reply" href="javascript:;"><b class="hide-clip">回复</b></a>
																				<!--
                                                                                <a class="act-delete none" href="server/test.php?action=delchildmsg"><b class="hide-clip">删除</b></a>
																				-->
                                                                            </div>
                                                                        </div>
                                                                        <div class="comment-box-wrap">
                                                                            <form action="forum_newssave.php?action=reply&pid=<?php echo $com_arr['id'];?>" method="post">
																				<div class="sq-editor-cont">
																					<div class="sq-editor-text">
																						<div contenteditable="true" class="textarea"></div>
																						<input class="textarea-hidden" type="hidden"  name="strhtml" />
																					</div>
																					<div class="sq-editor-ft">
																						<div class="sq-editor-attach">
																							<ul>
																								<li><a class="btn-link-append" href="javascript:;">超链接<i class="icon icon-link"></i></a></li>
																							</ul>
																						</div>
																						<div class="sq-editor-op"><input type="submit" value="发表" class='btn-post' ></div>
																					</div>
																				</div>
																			</form>
                                                                        </div>
                                                                        <?php echo getComList($com_arr['id'],'kboy_forum_news','forum_newssave.php');?>
                                                                    </div>
                                                                </li>
																<?php	
																	}
																?>
																
                                                            </ul>
                                                         </div>
														 <?php	
															}
														?>
                                                        <div class="mod-commnets-poster">
                                                            <div class="comments-box" >
                                                                <div class="text-input"><a href="javascript:;" class="sq-tx">我也说一句</a></div>
                                                                <div class="mod-insert-mess"><a href="javascript:;"><i class="icon icon-mess"></i></a></div>
                                                            </div>
                                                            <div class="comment-box-wrap">
                                                                <form action="forum_newssave.php?action=reply&pid=<?php echo $news_rs['id'];?>" method="post">
                                                                    <div class="sq-editor-cont">
                                                                        <div class="sq-editor-text">
                                                                            <div contenteditable="true" class="textarea"></div>
                                                                            <input class="textarea-hidden" type="hidden" name="strhtml" />
                                                                        </div>
                                                                        <div class="sq-editor-ft">
                                                                            <div class="sq-editor-attach">
                                                                                <ul>
                                                                                    <li><a class="btn-link-append" href="javascript:;">超链接<i class="icon icon-link"></i></a></li>
                                                                                </ul>
                                                                            </div>
                                                                            <div class="sq-editor-op"><a href="javascript:void(0)" class="btn-post">发表</a></div>
                                                                        </div>
                                                                    </div>
                                                                </form>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                    </div>
                                </li>
							<?php
								}
							?>
								
                            </ul>
                            <!-- <div class="s-watch-more">
                                <a href="javascript:;">
                                    <span>查看更多</span>
                                    <i></i>
                                </a>
                            </div> -->
										<?php
												if($pagenum > $pagesize){
													echo "<div class=\"pagination\"><ul>";
													$url = "forum_news.php?uid=$uid";//当前页面
													pagebar($pagecount, $pageval, 7, $url);
													echo "</ul></div>";
												}
										?>
								
                                   

                        </div>
                    </div>
                </div>
				
				
				<? include("_include.forum.right.php") ?>
				
            </div>
        </div>
    </div>
    <?php } ?>	
    <!--foot begin-->
	<? include("_include.bottom.footbar.php") ?>
    <!--foot begin-->
    <!--左侧悬浮 begin-->
	<? include("_include.bottom.leftbar.php") ?>
    <!--左侧悬浮 end-->
    <!--右侧悬浮导航 begin-->
	<? include("_include.bottom.rightbar.php") ?>
    <!--右侧悬浮导航 end-->
    <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="js/jquery.SuperSlide.2.1.1.js"></script>
    <script type="text/javascript" src="layer/layer.js"></script>
    <script type="text/javascript" src="piclayer/piclayer.min.js"></script>
    <script src="js/jquery.ui.widget.js"></script>
    <script src="js/jquery.iframe-transport.js"></script>
    <script src="js/jquery.fileupload.js"></script>
 
    <script type="text/javascript" src="js/main.js"></script>
    <script type="text/javascript" src="js/sq.js"></script>
    <script>
    ;!function(){
        piclayer.use('extend/piclayer.ext.js', function(){
            //初始加载即调用，所以需放在ext回调里
            piclayer.ext = function(){
                piclayer.photosPage({
                    parent:'.img-box'
                });
            };
        });
    }();
    </script>
 
</body>
</html>

